package MULE.Model;

import java.awt.Color;

/**
 * The Player class represents a player. It has player's name, race and color.
 * 
 * @ author Anastasiya Cotton @ version 1.0 10.04.2013
 */
public class Player implements java.io.Serializable {

	/**
	 * Serial version ID.
	 */
	private static final long serialVersionUID = -2649370421145601037L;

	private int id;
	private String name;
	private Race race;
	private Color color;
	private Inventory inventory;

	/**
	 * Creates new player with given name, race and color.
	 * 
	 * @param name
	 *            The name of the player.
	 * @param race
	 *            The race of the player.
	 * @param color
	 *            The color of the player.
	 */
	public Player(int id, String name, Race race, Color color) {
		this.id = id;
		this.name = name;
		this.race = race;
		this.color = color;
		this.inventory = new Inventory();
	}

	/**
	 * Get this player's number.
	 * 
	 * @return Player's number.
	 */
	public int getId() {
		return id;
	}

	/**
	 * To get player's name
	 * 
	 * @return Player's name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * To get player's race
	 * 
	 * @return player's race
	 */
	public Race getRace() {
		return race;
	}

	/**
	 * To get player's color
	 * 
	 * @return player's color
	 */
	public Color getColor() {
		return color;
	}

	/**
	 * Returns this player's inventory.
	 * 
	 * @return Player's inventory.
	 */
	public Inventory getInventory() {
		return inventory;
	}

	/**
	 * Returns this player's score. A player's score is determined by their
	 * total assets.
	 * 
	 * @return The player's score.
	 */
	public int getScore() {
		return this.inventory.getTotalAssets();
	}

	/**
	 * Returns this player's total money.
	 * 
	 * @return The player's money.
	 */
	public int getMoney() {
		return this.inventory.getAmount(Resource.MONEY);

	}

	/**
	 * Returns whether or not this player has a mule.
	 * 
	 * @return True if the player has a mule, false otherwise.
	 */
	public boolean hasMule() {
		if (this.getInventory().getAmount(Resource.MULE) > 0) {
			return true;
		}
		return false;
	}

	public void removeMule() {
		this.inventory.removeMule();
	}
}
